$('#executeQueryButton').click(function() {
	var sql = $('#sqlTextarea').val();
	console.log(sql);

	var request = $.ajax({
		type : 'POST',
		url : 'developer/executeSQL',
		data : JSON.stringify({
			sql : $('#sqlTextarea').val(),
			note : $('#note').val()
		}),
		contentType : 'application/json'
	});

	request.done(function(msg) {
		var result = jQuery.parseJSON(msg);
		console.log(result.result[0]);
		FMap.insertTerritoriesFromText(result.result[0]);
	});
	request.fail(function(jqXHR, textStatus) {
		console.log('Request failed: ' + textStatus);
	});

});